import { Context } from 'koa';

class ResponseOk {
  success(data: any = [], msg: string = 'success OK') {
    return {
      code: 200,
      message: msg,
      result: data,
      timestamp: new Date().getTime(),
    };
  }
  error(msg: string, code: number = 500, ctx?: Context) {
    //ctx.status = code;
    return {
      code: code,
      message: msg,
      result: [],
      timestamp: new Date().getTime(),
    };
  }
}
export default new ResponseOk();
